<?php
ini_set('include_path', '/Users/antti/projects/solar:' . '/Users/antti/projects/abovo/trunk:'. get_include_path());

require_once 'Solar.php';
Solar::start(dirname(__FILE__) . '/Solar.config.php');

// add auth credentials
$auth = Solar::factory('Abovo_Model_Auth');
$data = array(
    'handle'   => 'admin',
    'password' => 'solarmagic',
);
$out = $auth->insert($data);

// add contact info for admin
$users = Solar::factory('Abovo_Model_Contacts_Users');
$data = array(
    'handle'    => $out['handle'],
    'firstname' => 'Admin',
    'lastname'  => 'Administrator',
    'gender'    => 1,
    'email'     => 'admin@example.com',
    'adr'       => 'Some street 1234',
    'city'      => 'Helsinki',
    'country'   => 'FI',
);
$users->insert($data);

// add some apps
$menu = Solar::factory('Abovo_Menu');

$apps = array(
    'Abovo_App_Crm_Wiki',
    'Abovo_App_System_Users',
);

foreach ($apps as $app) {
    $menu->insert($app);
}

// add permissions
$perms = Solar::factory('Abovo_Model_Perms');

$perms->grant('admin', 'Abovo_App_System_Users', 'permissions');
$perms->grant('admin', 'Abovo_App_System_Users', 'users');
$perms->grant('admin', 'Abovo_App_Crm_Wiki', 'page');
$perms->grant('admin', 'Abovo_App_Crm_Wiki', 'edit');

Solar::stop();

?>